# encoding: utf-8
# author: 侯佳涛
# file_name: urls
# create_time: 2022/1/21, 下午2:56
from django.conf.urls import url

from . import views

urlpatterns = [
    # url(r'^$', views.RegisterView.as_view(), name='index'),
    url(r'^register/$', views.RegisterView.as_view(), name='register'),  # 进行重定向的页面需要写命名空间，不需要重定向的不需要写
    # 校验用户名是否重复路由
    url(r'^usernames/(?P<username>[a-zA-Z0-9_-]{5,20})/count/$', views.UserNameCountView.as_view()),
    # 校验手机号码是否重复路由
    url(r'^mobiles/(?P<mobile>1[3-9]\d{9})/count/$', views.MobileCountView.as_view()),
    # 用户注册路由
    url(r'^login/$', views.LoginView.as_view(), name='login'),
    # 登出路由
    url(r'^logout/$', views.LogoutView.as_view(), name='logout'),
    # 用户中心路由
    url(r'^info/$', views.UserInfoView.as_view(), name='info'),
    # 添加邮箱路由
    url(r'^emails/$', views.EmailView.as_view()),
    # 邮箱验证路由
    url(r'^emails/verification/$', views.EmailVerifyView.as_view()),
    # 收货地址路由
    url(r'^addresses/$', views.AddressView.as_view(), name='address'),
    # 新增收货地址路由
    url(r'^addresses/create/$', views.AddressCreateView.as_view()),
    # 更新和删除收货地址路由
    url(r'^addresses/(?P<address_id>\d+)/$', views.UpdateDestroyView.as_view()),
    # 设置默认地址路由
    url(r'^addresses/(?P<address_id>\d+)/default/$', views.SetDefaultAddressView.as_view()),
    # 修改标题路由
    url(r'^addresses/(?P<address_id>\d+)/title/$', views.ChangeTitleView.as_view()),
    # 修改密码路由
    url(r'^chang_password/$', views.ChangePasswordView.as_view(), name='pass'),
    # 用户浏览记录路由
    url(r'^browse_histories/$', views.UserBrowseHistoryView.as_view())

]

